package com.ojoin.trade.supplyloan_core.web.controller;

import java.util.List;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ojoin.trade.common.web.controller.BaseController;
import com.ojoin.trade.common.web.controller.BaseControllerImpl;
import com.ojoin.trade.common.web.domain.Result;
import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlLoanStatDay;
import com.ojoin.trade.supplyloan_core.web.service.TbSlLoanStatDayService;

@Controller 
@RequestMapping("/operate/tbslloanstatday") 
public class SlLoanStatDayController extends BaseControllerImpl<TbSlLoanStatDay> implements BaseController<TbSlLoanStatDay>{
 
		private org.slf4j.Logger log = LoggerFactory
				.getLogger(SlLoanStatDayController.class);
 
		@Autowired  
		private TbSlLoanStatDayService service; 
		      
		@Override
		protected BaseService<TbSlLoanStatDay> getBaseService() {
		
			return service;
		}
		 
		

		/*
		 * 根据公司名称，平台，时间查询统计数据
		 */ 
		@ResponseBody
		@RequestMapping(value = "/queryByPlatformAndMerchantUserIDAndDate", method = RequestMethod.POST)
		public Result queryByPlatformAndMerchantUserIDAndDate(@Param("platformName")String platformName,@Param("merchantUserId")String merchantUserId,@Param("statDate")String statDate) {

			 
			try {
				 List<TbSlLoanStatDay> li =  service.queryByPlatformAndMerchantUserIDAndDate(platformName, merchantUserId, statDate);
				return new Result(Result.Status.OK, li);
			} catch (Exception e) { 
				log.error("", e);
				return new Result(Result.Status.ERROR, "查询电商业务数据统计失败");
			}

		}



	





		



		
		

	}
